home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2794 < prev    next >
Encoding:
Text File  |  1996-08-06  |  748 b   |  33 lines

  1. Path: drivel.ics.uci.edu!ucivax!gateway
  2. From: klefstad@catalina.ICS.UCI.EDU ("Raymond Klefstad, Ph.D.")
  3. Subject: Parameterless functions
  4. Message-ID: <9601191115.aa06760@paris.ics.uci.edu>
  5. Date: 19 Jan 96 19:18:31 GMT
  6. Newsgroups: comp.lang.c++
  7.  
  8.  
  9. Why does the following function work?  Is this just gcc or is it correct
  10. C++?  endl and ends are implemented this way.
  11.  
  12. #include <iostream.h>
  13.  
  14. ostream& newline(ostream& out)
  15. {
  16.     return out << "Hello";
  17. }
  18.  
  19. main()
  20. {
  21.     cout << "Hello" << newline;
  22. }
  23.  
  24.  
  25. Also, I noticed the following in some of the standard headers for gcc:
  26.  
  27. int foo(int x) return y
  28. {
  29.     y = 10;
  30.     // do stuff and drop of the end of the function, but y is returned
  31.     // similar to Pascal.  Is this valid C++ or just GNU extensions.
  32. }
  33.